home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / System / ReqToolsLib / Source / reqtools / rtlocale.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-02  |  1.6 KB  |  69 lines

  1. /*********
  2. * LOCALE *
  3. *********/
  4.  
  5. #include "filereq.h"
  6.  
  7. #include <proto/locale.h>
  8. #include <string.h>
  9.  
  10. #ifdef _AROS
  11. #include <aros/macros.h>
  12. #endif
  13.  
  14. /****************************************************************************************/
  15.  
  16. char *REGARGS GetStr (struct Catalog *cat, char *idstr)
  17. {
  18.     char  *local;
  19.     UWORD id = *(UWORD *)idstr;
  20.  
  21. #ifdef _AROS
  22. #if !AROS_BIG_ENDIAN
  23.     id = AROS_BE2WORD(id);
  24. #endif
  25. #endif    
  26.     local = idstr + 2;
  27.     if (LocaleBase) return ((char *)GetCatalogStr (cat, id, local));
  28.     return (local);
  29. }
  30.  
  31. /****************************************************************************************/
  32.  
  33. //ULONG catalogtags[] = { OC_Version, 38, TAG_END };
  34. #define catalogtags    NULL
  35.  
  36. #undef ThisProcess()
  37. #define ThisProcess()        ((struct Process *)FindTask(NULL))
  38.  
  39. /****************************************************************************************/
  40.  
  41. struct Catalog *REGARGS RT_OpenCatalog (struct Locale *locale)
  42. {
  43.     struct Process     *proc;
  44.     struct Catalog     *cat;
  45.     APTR         oldwinptr;
  46.  
  47.     if (!LocaleBase) return (NULL);
  48.  
  49.     proc = ThisProcess();
  50.  
  51.     if (proc->pr_Task.tc_Node.ln_Type != NT_PROCESS) return (NULL);
  52.  
  53.     oldwinptr = proc->pr_WindowPtr;
  54.     proc->pr_WindowPtr = (APTR)-1;
  55.     cat = OpenCatalogA (locale, "reqtools.catalog", (struct TagItem *)catalogtags);
  56.     proc->pr_WindowPtr = oldwinptr;
  57.  
  58.     return (cat);
  59. }
  60.  
  61. /****************************************************************************************/
  62.  
  63. void REGARGS RT_CloseCatalog (struct Catalog *cat)
  64. {
  65.     if (LocaleBase) CloseCatalog (cat);
  66. }
  67.  
  68. /****************************************************************************************/
  69.